import { BigNumber } from "ethers";
import { sendTransaction } from "@/init";

export async function sendTx(txObject, extra){
    if(txObject.data === "0x" || typeof txObject.to !== "string"){
        throw new Error("Malformed tx") // Should never happen
    }
    // if(txObject.gasLimit === undefined){
    //     const gasPrediction = await signer.estimateGas(txObject)
    //     txObject.gasLimit = BigNumber.from(gasPrediction).mul(14).div(10).toNumber() // Increase gas +40%
    // }
    return sendTransaction(txObject, extra);
}
